package com.hpeng.sys.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.hpeng.sys.dao.SysUserDao;
import com.hpeng.sys.model.Department;
import com.hpeng.sys.model.Staff;
import com.hpeng.sys.model.SysTemplate;
import com.hpeng.sys.model.SysUser;
import com.hpeng.sys.service.Function;
import com.hpeng.sys.service.SysUserMgr;
import com.hpeng.util.Pagination;

@Component("sysUserMgr")
public class SysUserMgrImpl implements SysUserMgr {

	public List<SysUser> getSysUsers() {
		return sysUserDao.getSysUsers();
	}
	
	public SysUser getUser(String userCode){
		return sysUserDao.getUser(userCode);
	}
	
	public List<SysUser> getUserByCode(String usercode){
		return sysUserDao.getUserByCode(usercode);
	}
	
	public List<SysUser> getUserByName(String username){
		return sysUserDao.getUserByName(username);
	}
	
	public List<SysUser> getUserByStaff(List<Staff> staffs){
		return sysUserDao.getUserByStaff(staffs);
	}
	
	public List<SysUser> getUserByTpl(List<SysTemplate> Tpl){
		return sysUserDao.getUserByTpl(Tpl);
	}
	
	public Pagination<SysUser> getPagination(int pageNumber) {
		return sysUserDao.getPagination(pageNumber);
	}
	
	public void saveUser(SysUser sysUser){
		sysUserDao.saveUser(sysUser);
		function.modifyUserAuthorities(sysUser.getUserCode());
	}
	public void deleteUser(List<String> deleteUsers){
		sysUserDao.deleteUser(deleteUsers);
	}
	
	public List<SysUser> getUserByDep(List<Department> departments){
		return sysUserDao.getUserByDep(departments);
	}
	
	public void updateUser(SysUser sysUser){
		sysUserDao.updateUser(sysUser);
	}
	
	@Resource
	private SysUserDao sysUserDao;
	@Resource
	private Function function;

}
